jwerty.key('alt+shift+L', function(){
    $.ajax({url : '/eventijesolo/ajax/is_logged_in.php',
        type: 'POST',
        dataType : 'json',
        cache: false,
        success : function(data){
        if (data['logged_in'] == 0) {
            if ($('#login-box').length <= 0) {
                var login_box = $('<div id="login-box" style="display: none;"><div class="container"><div class="row"><div class="span12" id="insert-here"></div></div></div></div>');
                var login_form = $('<form class="form-inline" action="/eventijesolo/login/" method="POST"></form>');
                login_form.append('<input type="text" class="input-large" placeholder="Username" id="username" name="username" />');
                login_form.append('<input type="password" class="input-large" placeholder="Password" id="password" name="password" />');
                login_form.append('<label class="checkbox"><input type="checkbox" name="remember-me" checked="checked"> Ricordami</label>');
                var submit_btn = $('<button type="submit" class="btn btn-primary" name="submit">Login</button>');
                submit_btn.click(function(){

                    var usr_input = login_form.find('#username');
                    var pwd_input = login_form.find('#password');
                    if (usr_input.val() != '' && pwd_input.val() != '') {
                        var md5 = CryptoJS.MD5(pwd_input.val());
                        pwd_input.val(md5);
                        return true;
                    }
                    return false;
                });
                login_form.append(submit_btn);
                login_box.find('#insert-here').append(login_form);
                $('body').prepend(login_box);
                login_box.slideDown('slow', function(){
                    $(this).find('#username').focus();
                });
            } else {
                $('#login-box').find('#username, #password').blur();
                $('#login-box').slideUp('slow', function() {
                    $(this).remove();
                });
            }
        } else {
            if ($('#user-box').length <= 0) {
                var user_box = $('<div id="user-box" style="display: none;"><div class="container"><div class="row"><div class="span12" id="insert-here"></div></div></div></div>');
                var logout_btn = $('<a href="/eventijesolo/logout/" class="btn btn-danger">Logout</button>');
                var where = user_box.find('#insert-here');
                where.append('<p>Ciao, ' + data['user'] + '!</p>');
                where.append(logout_btn);
                $('body').prepend(user_box);
            }
            $('#user-box').slideToggle('slow');
        }
    }
    });
});